package com.mycompany.app.hr.tna.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * Attendance Record Existence Rule: 1. If Employee works on workday, at least
 * one Attendance Record must exist regardless of Absence or others. 2. It is
 * eligible that Attendance Records appears on rest day,
 * 
 * @author Shawn.guo
 */
@Entity
@Table(name = "tna_attendance_record")
@SuppressWarnings(value={"unused"})
public class AttendanceRecord {

    /**
     * N, normal (work day with normal work time) (for rest day with zero OT)
     * LH, less Hours( late in/early out/late in and early out MP, mispunch AW,
     * Absence OT, (for rest day)(public holiday)
     * 
     * @author Shawn.guo
     */
    public static enum RegularWorkingStatus {
        N, LH, MP, AW, OT
    };

    private Long id;

    private String gid;

    

    // Regular Payment
    // =============================
    private Float scheduleRegularHours;
    /**
     *Actual working hour = actual working hour - deduct hours
     */
    private Float actualRegularHours;

    /**
     * If employee is late in and/or early out on workday, system will subtract
     * predefined hours from actual working hours to punish it.
     */
    private Float deductHours;

    //can calculate by punch clock info,not necessary to store and maintain.

    // OT Payment
    // =============================
    private boolean hasOT;

    private Float ot150Hours;

    private Float ot200Hours;

    private Float ot300Hours;

    // leave info
    /**
     * For employee on full-day leave or having two half-day leaves, system will
     * do Create absent record which will create absent record including leave
     * information
     */
    // ==============================\
    private boolean hasLeave;

    private String leaveCode;

    // working status
    private RegularWorkingStatus workingStatus = RegularWorkingStatus.AW;

    // punch clock info
    private Date scheduledPunchIn;

    private Date scheduledPunchOut;

    private Date actualPunchIn;

    private Date actualPunchOut;

    private Date calcActualPunchIn;

    private Date calcActualPunchOut;

    // ==============================

    //extro info
    //if has leave, then stores leave code for display in UI.
    private String remark;

    private String modifyReason;

    private String otRejectReason;

    // =======================================================
    @Override
    public String toString() {

        return ToStringBuilder.reflectionToString(this);
    }

    // =======================================================

    public Long getId() {

        return id;
    }

    public void setId(Long id) {

        this.id = id;
    }

    public String getGid() {

        return gid;
    }

    public void setGid(String gid) {

        this.gid = gid;
    }

    public boolean isHasOT() {

        return hasOT;
    }

    public void setHasOT(boolean hasOT) {

        this.hasOT = hasOT;
    }

    public Float getOt150Hours() {

        return ot150Hours;
    }

    public void setOt150Hours(Float ot150Hours) {

        this.ot150Hours = ot150Hours;
    }

    public Float getOt200Hours() {

        return ot200Hours;
    }

    public void setOt200Hours(Float ot200Hours) {

        this.ot200Hours = ot200Hours;
    }

    public Float getOt300Hours() {

        return ot300Hours;
    }

    public void setOt300Hours(Float ot300Hours) {

        this.ot300Hours = ot300Hours;
    }

    public RegularWorkingStatus getWorkingStatus() {

        return workingStatus;
    }

    public void setWorkingStatus(RegularWorkingStatus workingStatus) {

        this.workingStatus = workingStatus;
    }

    public String getLeaveCode() {

        return leaveCode;
    }

    public void setLeaveCode(String leaveCode) {

        this.leaveCode = leaveCode;
    }

}
